#ifndef CONVERTION_HPP
#define CONVERTION_HPP

#include <QtCore/QString>

#include <boost/lexical_cast.hpp>

#include <iostream>

template< typename T >
bool lireValeur( const QString& source, T& destination )
{
  try
    {
      destination = boost::lexical_cast< T >( source.constData() );
    }
  catch( boost::bad_lexical_cast& e )
    {
      std::cerr << e.what() << " \'" << source.constData() << "\'" << std::endl;
      return false;
    }
  
  return true;
};

#endif // CONVERTION_HPP
